import java.awt.Color;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import java.util.jar.Attributes.Name;


public abstract class Robots implements KeyListener {
	// DESIGN CONSDERATIONS
	// Make the Robots keyListener, add the keyListeners to the arena when robots are added
	
	
	// What components/properties do we want our robots to have?
	//    -type ?, name, color, size?, Kill count?
	protected Color _bodyColor; // made private so subclasses inherit, instead of private
	protected int _killcount = 0; // <---- how to implement killing/ shooting ?
	protected int _leftKey,_rightKey,_upKey,_downKey; // So we can change the controls later
	protected int _moveInterval = 10; // moves 10 pixels minimum everytime
	//-----------------------------------------------------------------------------------------------------------------
	//METHODS
	//----------------------------------------------------------------------------
	
	//Constructor
	public Robots(){
		this.setDefaultControls();
		
	}
	
	
	private void setDefaultControls() {
		// Sets Default controls to arrow pad
		_leftKey= KeyEvent.VK_LEFT;
		_rightKey= KeyEvent.VK_RIGHT;
		_upKey = KeyEvent.VK_UP;
		_downKey = KeyEvent.VK_DOWN;
		
	}


	// What methods(actions ) do we want all of our robots to HAVE to do
	public abstract void shoot();
		// all robots must shoot, may not need to be abstract
	public abstract boolean containsPoint(int x,int y); // abstract means let subclass
	//determine how to handle this method , ie.) square robot acts different than circle robot
	public abstract void turnLeft();
	public abstract void turnRight();
	public abstract void moveFoward(int distanceMoved); // no strafing so far
	public abstract void blowUp();
	
	
	
	@Override
	public void keyPressed(KeyEvent e) {
		// Robot Controls , for now 90 degree turns , later implement held keys
		
		if (e.getKeyCode()==_leftKey){
			turnLeft();		
		}
		else if (e.getKeyCode()==_rightKey){
			turnLeft();
		}
		else if(e.getKeyCode()==_upKey){
			moveFoward(_moveInterval);
		}
		else if (e.getKeyCode()==_downKey){
			moveFoward(-1*_moveInterval);// goes backward same speed as foward, can change
		}
		else if(e.getKeyCode()==e.VK_ENTER){
			//Just a test 
			System.out.println("ENTER PRESSED, KEY LISTENER WORKS");
		}
			
		
	}

	@Override // @Override overrides methods from super class,
	// by default the method will overrde it anyway 
	//typing @Override is just more rigourous and protects against spelling mistakes
	public void keyReleased(KeyEvent e) {
		// Not relevant right now	
	}

	@Override
	public void keyTyped(KeyEvent e) {
		// not relevant	
	}
	
	
	
	
	
	

}
